<template>
  <z-paging ref="paging" v-model="dataList" @query="queryList">
    
    <view w-full pa-40rpx box-border>
      
      <view w-full box-border class="'row-1-col-2'">
        <template v-for="(item, index) in dataList" :key="index">
          <vrItem
            :item="item"
            @click="toVrDetail(item)"></vrItem>
        </template>
      </view>
    </view>
  </z-paging>
</template>

<script setup lang="ts">
import { selectVrList } from '@/api/vr'
import vrItem from '@/pages/funcPages/components/vr/vrItem.vue'
import { onLoad } from '@dcloudio/uni-app'


const dataList = ref<any>([])
const paging = ref<any>(null)


function toVrDetail(item:any) {
  uni.navigateTo({
    url: '/pages/funcPages/vr/vr?id=' + item.vrId
  })
}

const queryList = (pageNo: number, pageSize: number) => {
  // 此处请求仅为演示，请替换为自己项目中的请求
  selectVrList({
    pageNumber: pageNo,
    pageSize: pageSize
  })
    .then((res: any) => {
      paging.value.complete(res.data.result.records)
    })
    .catch((res) => {
      paging.value.complete(false)
    })
}

onLoad((options: any) => {
 
})

</script>
<style>
page {
  background-color: #fff;
  --nut-menu-bar-box-shadow: none;
}
</style>
<style scoped lang="scss">
.row-1-col-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-column-gap: 30rpx;
}
</style>
